﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>测试多图表切换显示</title>
    <script src="../XEngine/LineUtil.js"></script>
    <script src="../XEngine/XEngine.js"></script>
    <script src="../XEngine/XSVG.js"></script>
    <script src="../XEngine/XNode.js"></script>
    <script src="../XWorkflow/XWFActivity.js"></script>

    <script type="text/javascript">
        var d1, d2;
        window.onload = function () {
            // 初始化流程引擎
            XEngine.init(document.getElementById('container'));

            // 创建一个图表用于显示流程图
            d1 = XEngine.createDiagram('d1');

            // 创建一个节点
            var rect1 = new XWFProcess('act in D1');
            rect1.setPos(200, 200);
            rect1.setSize(50, 50);
            d1.add(rect1);

            // 显示图表
            XEngine.showDiagram(d1);

            // 创建一个图表用于显示流程图
            d2 = XEngine.createDiagram('d2');

            // 创建一个节点
            var rect2_1 = new XWFProcess('act in D2');
            rect2_1.setPos(100, 200);
            rect2_1.setSize(100, 50);
            d2.add(rect2_1);
        }

        function showD1() {
            XEngine.showDiagram(d1);
            document.getElementById('debug').innerHTML = XEngine.getCurrentDiagram().getName();
        }

        function showD2() {
            XEngine.showDiagram(d2);
            document.getElementById('debug').innerHTML = XEngine.getCurrentDiagram().getName();
        }
    </script>
</head>
<body>
    <button onclick="showD1();">Show Diagram1</button>
    <button onclick="showD2();">Show Diagram2</button>
    <div id="debug"></div>
    <div id="container" style="width:100%; height:600px;">

    </div>
</body>
</html>
